<?php
try {
    $pdo = new PDO('mysql:host=113.44.136.17;port=3306;dbname=qiandao;charset=utf8mb4', 'qiandao', 'NGbks3HWx5PhSxDX');
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    
    // 检查总会员数
    $stmt = $pdo->query('SELECT COUNT(*) as total FROM checkin_member');
    $result = $stmt->fetch();
    echo "Total members: " . $result['total'] . "\n";
    
    // 检查会员样本
    $stmt = $pdo->query('SELECT id, name, register_store_id, status FROM checkin_member LIMIT 10');
    $members = $stmt->fetchAll();
    echo "Sample members:\n";
    foreach($members as $member) {
        echo "  ID: {$member['id']}, Name: {$member['name']}, Store: {$member['register_store_id']}, Status: {$member['status']}\n";
    }
    
    // 检查门店1的启用会员
    $stmt = $pdo->query('SELECT COUNT(*) as total FROM checkin_member WHERE register_store_id = 1 AND status = 1');
    $result = $stmt->fetch();
    echo "Store 1 active members: " . $result['total'] . "\n";
    
    // 检查所有门店的会员分布
    $stmt = $pdo->query('SELECT register_store_id, COUNT(*) as count FROM checkin_member GROUP BY register_store_id');
    $stores = $stmt->fetchAll();
    echo "Members by store:\n";
    foreach($stores as $store) {
        echo "  Store {$store['register_store_id']}: {$store['count']} members\n";
    }
    
} catch (Exception $e) {
    echo "Error: " . $e->getMessage() . "\n";
}
?>
